3.1.18 \(\int (a+a \cos (c+d x))^2 \sec (c+d x) \, dx\) [18]

Optimal. Leaf size=34 \[ 2 a^2 x+\frac {a^2 \tanh ^{-1}(\sin (c+d x))}{d}+\frac {a^2 \sin (c+d x)}{d} \]

[Out]

2*a^2*x+a^2*arctanh(sin(d*x+c))/d+a^2*sin(d*x+c)/d

________________________________________________________________________________________

Rubi [A]
time = 0.04, antiderivative size = 34, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, integrand size = 19, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.158, Rules used = {2825, 2814, 3855} \begin {gather*} \frac {a^2 \sin (c+d x)}{d}+\frac {a^2 \tanh ^{-1}(\sin (c+d x))}{d}+2 a^2 x \end {gather*}

Antiderivative was successfully verified.

[In]

Int[(a + a*Cos[c + d*x])^2*Sec[c + d*x],x]

[Out]

2*a^2*x + (a^2*ArcTanh[Sin[c + d*x]])/d + (a^2*Sin[c + d*x])/d

Rule 2814

Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])/((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[b*(x/d)
, x] - Dist[(b*c - a*d)/d, Int[1/(c + d*Sin[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d
, 0]

Rule 2825

Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])^2/((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(-b^2
)*(Cos[e + f*x]/(d*f)), x] + Dist[1/d, Int[Simp[a^2*d - b*(b*c - 2*a*d)*Sin[e + f*x], x]/(c + d*Sin[e + f*x]),
 x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0]

Rule 3855

Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-ArcTanh[Cos[c + d*x]]/d, x] /; FreeQ[{c, d}, x]

Rubi steps

\begin {align*} \int (a+a \cos (c+d x))^2 \sec (c+d x) \, dx &=\frac {a^2 \sin (c+d x)}{d}+\int \left (a^2+2 a^2 \cos (c+d x)\right ) \sec (c+d x) \, dx\\ &=2 a^2 x+\frac {a^2 \sin (c+d x)}{d}+a^2 \int \sec (c+d x) \, dx\\ &=2 a^2 x+\frac {a^2 \tanh ^{-1}(\sin (c+d x))}{d}+\frac {a^2 \sin (c+d x)}{d}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.02, size = 47, normalized size = 1.38 \begin {gather*} 2 a^2 x+\frac {a^2 \tanh ^{-1}(\sin (c+d x))}{d}+\frac {a^2 \cos (d x) \sin (c)}{d}+\frac {a^2 \cos (c) \sin (d x)}{d} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[(a + a*Cos[c + d*x])^2*Sec[c + d*x],x]

[Out]

2*a^2*x + (a^2*ArcTanh[Sin[c + d*x]])/d + (a^2*Cos[d*x]*Sin[c])/d + (a^2*Cos[c]*Sin[d*x])/d

________________________________________________________________________________________

Maple [A]
time = 0.11, size = 44, normalized size = 1.29

method result size
derivativedivides \(\frac {a^{2} \sin \left (d x +c \right )+2 a^{2} \left (d x +c \right )+a^{2} \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{d}\) \(44\)
default \(\frac {a^{2} \sin \left (d x +c \right )+2 a^{2} \left (d x +c \right )+a^{2} \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{d}\) \(44\)
risch \(2 a^{2} x -\frac {i a^{2} {\mathrm e}^{i \left (d x +c \right )}}{2 d}+\frac {i a^{2} {\mathrm e}^{-i \left (d x +c \right )}}{2 d}+\frac {a^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right )}{d}-\frac {a^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right )}{d}\) \(85\)
norman \(\frac {2 a^{2} x +\frac {2 a^{2} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d}+\frac {2 a^{2} \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}+4 a^{2} x \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+2 a^{2} x \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{2}}+\frac {a^{2} \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{d}-\frac {a^{2} \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{d}\) \(134\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a+a*cos(d*x+c))^2*sec(d*x+c),x,method=_RETURNVERBOSE)

[Out]

1/d*(a^2*sin(d*x+c)+2*a^2*(d*x+c)+a^2*ln(sec(d*x+c)+tan(d*x+c)))

________________________________________________________________________________________

Maxima [A]
time = 0.28, size = 43, normalized size = 1.26 \begin {gather*} \frac {2 \, {\left (d x + c\right )} a^{2} + a^{2} \log \left (\sec \left (d x + c\right ) + \tan \left (d x + c\right )\right ) + a^{2} \sin \left (d x + c\right )}{d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+a*cos(d*x+c))^2*sec(d*x+c),x, algorithm="maxima")

[Out]

(2*(d*x + c)*a^2 + a^2*log(sec(d*x + c) + tan(d*x + c)) + a^2*sin(d*x + c))/d

________________________________________________________________________________________

Fricas [A]
time = 0.41, size = 53, normalized size = 1.56 \begin {gather*} \frac {4 \, a^{2} d x + a^{2} \log \left (\sin \left (d x + c\right ) + 1\right ) - a^{2} \log \left (-\sin \left (d x + c\right ) + 1\right ) + 2 \, a^{2} \sin \left (d x + c\right )}{2 \, d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+a*cos(d*x+c))^2*sec(d*x+c),x, algorithm="fricas")

[Out]

1/2*(4*a^2*d*x + a^2*log(sin(d*x + c) + 1) - a^2*log(-sin(d*x + c) + 1) + 2*a^2*sin(d*x + c))/d

________________________________________________________________________________________

Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} a^{2} \left (\int 2 \cos {\left (c + d x \right )} \sec {\left (c + d x \right )}\, dx + \int \cos ^{2}{\left (c + d x \right )} \sec {\left (c + d x \right )}\, dx + \int \sec {\left (c + d x \right )}\, dx\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+a*cos(d*x+c))**2*sec(d*x+c),x)

[Out]

a**2*(Integral(2*cos(c + d*x)*sec(c + d*x), x) + Integral(cos(c + d*x)**2*sec(c + d*x), x) + Integral(sec(c +
d*x), x))

________________________________________________________________________________________

Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 79 vs. \(2 (34) = 68\).
time = 0.48, size = 79, normalized size = 2.32 \begin {gather*} \frac {2 \, {\left (d x + c\right )} a^{2} + a^{2} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right ) - a^{2} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right ) + \frac {2 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 1}}{d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+a*cos(d*x+c))^2*sec(d*x+c),x, algorithm="giac")

[Out]

(2*(d*x + c)*a^2 + a^2*log(abs(tan(1/2*d*x + 1/2*c) + 1)) - a^2*log(abs(tan(1/2*d*x + 1/2*c) - 1)) + 2*a^2*tan
(1/2*d*x + 1/2*c)/(tan(1/2*d*x + 1/2*c)^2 + 1))/d

________________________________________________________________________________________

Mupad [B]
time = 0.40, size = 33, normalized size = 0.97 \begin {gather*} 2\,a^2\,x+\frac {a^2\,\left (2\,\mathrm {atanh}\left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )+\sin \left (c+d\,x\right )\right )}{d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a + a*cos(c + d*x))^2/cos(c + d*x),x)

[Out]

2*a^2*x + (a^2*(2*atanh(tan(c/2 + (d*x)/2)) + sin(c + d*x)))/d

________________________________________________________________________________________